﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace UniversityExample
{
    class GroupList
    {
        public string GroupName;
        List<StudentList> StudentsOfGroup = new List<StudentList>();
        public void AddStudentToGroup()
        {
            string choise;
            Console.WriteLine("Введите название группы");
            GroupName = Console.ReadLine();
            do
            {
                Console.Clear();
                StudentList student = new StudentList();
                student.Credentials();
                StudentsOfGroup.Add(student);
                Console.WriteLine("Желаете добавить еще студента? Д/Н");
                choise = Console.ReadLine();
            }
            while (choise == "Д" || choise == "д");
        }
            public void ShowFullListOfGroup()
        { 
            Console.WriteLine("Группа {0} состоит из:", GroupName);
            foreach (var student in StudentsOfGroup)
            {
                student.ShowStudentInfo();
                Console.WriteLine("Средний бал - {0}", student.AvareageMark());
            }
        }
        public void ShowFullListOfGroupWithoutMarks()
        {
            Console.WriteLine("Группа {0} состоит из:", GroupName);
            foreach (var student in StudentsOfGroup)
            {
                student.ShowStudentInfo();
            }
        }
        public void PrintStudentsWithAvarageMarkMoreThan()
        {
            bool isStudentExist = false;
            foreach (var student in StudentsOfGroup)
            if (student.AvareageMark() > 50)
                {
                    student.ShowStudentInfo();
                    isStudentExist = true;
                }
            if (!isStudentExist)
            {
                Console.WriteLine("Таких студентов нет!");
            }
        }
    }
}
